#!/bin/sh
BUILD_SPARC_LEON3_DIR=build_sparc_leon3_lwip
PROJECT_DIRECTORY=$(pwd)
TOOLSCHAIN_DIRECTORY=/opt/sparc-elf-3.4.4/bin

build_target_sparc_elf_lwip()
{
    echo "building for target sparc leon3"
    mkdir ${BUILD_SPARC_LEON3_DIR}
    cd ${BUILD_SPARC_LEON3_DIR}
    cmake   -D CMAKE_BUILD_TYPE=Release \
            -D CMAKE_C_FLAGS_DEBUG="-g -O0" \
            -D CMAKE_C_FLAGS_RELEASE="-g -O2" \
            -D CMAKE_AR=${TOOLSCHAIN_DIRECTORY}/sparc-elf-ar \
            -D CMAKE_C_COMPILER=${TOOLSCHAIN_DIRECTORY}/sparc-elf-gcc \
            -D CMAKE_CXX_COMPILER=${TOOLSCHAIN_DIRECTORY}/sparc-elf-c++ \
            -D CMAKE_LINKER=${TOOLSCHAIN_DIRECTORY}/sparc-elf-ld \
            -D CMAKE_NM=${TOOLSCHAIN_DIRECTORY}/sparc-elf-nm \
            -D CMAKE_OBJCOPY=${TOOLSCHAIN_DIRECTORY}/sparc-elf-objcopy \
            -D CMAKE_OBJDUMP=${TOOLSCHAIN_DIRECTORY}/sparc-elf-objdump \
            -D CMAKE_RANLIB=${TOOLSCHAIN_DIRECTORY}/sparc-elf-ranlib \
            -D CMAKE_STRIP=${TOOLSCHAIN_DIRECTORY}/sparc-elf-strip \
            $PROJECT_DIRECTORY
    cd -
} 

build_target_sparc_elf_lwip